package com.seeyon.apps.ext.ObxMsgPush.utils;

import java.util.Base64;

import org.apache.log4j.Logger;

import com.seeyon.ctp.portal.sso.SSOLoginHandshakeAbstract;
/** MySSOLoginHandshake需要在参数设置页面设定*类内部注释与方法不变 */
public class JdMessagetick extends SSOLoginHandshakeAbstract {
	private static final Logger log = Logger.getLogger(JdMessagetick.class);

	/**
	 * 握手方法，通过传入ticket获取对应的协同登录名
	 * 注意：【V6.1如果ticket不加密则无法正常登录】：示例中ticket未加密，正式开发中请一定对登录名加密，否则有安全隐患！
	 * 
	 * @return 返回ticket对应的协同登录名
	 */
	public String handshake(String ticket) {
		String userLogninName = "";
		if (ticket == null || ticket.equals("")) {
			return null;
		}
		userLogninName=ticket.substring(6, ticket.length());
		byte[] decoded = Base64.getDecoder().decode(userLogninName);
		userLogninName = new String(decoded);
	    log.info("Base 64 解密后：" + userLogninName);
		return userLogninName;
	}
	

	@Override
	public void logoutNotify(String arg0) {
		// TODO Auto-generated method stub
		
	}
}